package com.rdc.qingkou.presenter;

import com.rdc.qingkou.base.BasePresenterImpl;
import com.rdc.qingkou.contract.LoginContract;
import com.rdc.qingkou.model.LoginModel;
import com.rdc.qingkou.model.imodel.ILoginCallBack;
import com.rdc.qingkou.utils.DirectedLoginUtil;



public class LoginPrestener extends BasePresenterImpl<LoginContract.View> implements LoginContract.LoginPrestenerI {
       private LoginModel mLoginModel = new LoginModel();



    @Override
    public void jumpToRegister(boolean IsChangePassword) {
        mView.jumpToRegister(IsChangePassword);
    }



    @Override
    public void login() {

        mLoginModel.LoginRequest(mView.getAccount(), mView.getPassword(), new ILoginCallBack() {

            @Override
            public void onSuccess() {
                DirectedLoginUtil.setAccount(mView.getAccount(),mView.getPassword());
                mView.jumpToHomePage();
            }

            @Override
            public void onFail(String reason) {
                mView.showFail(reason);
            }
        });

    }
}
